/*
 * @Author: wufan 929523653@qq.com
 * @Date: 2025-08-20 11:40:10
 * @LastEditors: wufan 929523653@qq.com
 * @LastEditTime: 2025-08-21 11:25:02
 * @FilePath: \mars3d-vue-project-01\src\widgets\job-site-list\map.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import * as mars3d from "mars3d"

let map: mars3d.Map // 地图对象

// 需要覆盖config.json中地图属性参数（当前示例框架中自动处理合并）
export const mapOptions = {
  scene: {
    center: { lat: 31.628661, lng: 117.251952, alt: 46390, heading: 2, pitch: -68 }
  }
}

// 初始化当前业务
export function onMounted(mapInstance: mars3d.Map): void {
  map = mapInstance // 记录map
}

// 释放当前业务
export function onUnmounted(): void {
  map.graphicLayer.clear()
  map = null
}

// 飞向视角
export function flytoView(center) {
  map.setCameraView(center)
}
